package fizzpicks.tetrapulp.tetrapulp;

import pulpcore.scene.Scene2D;
import pulpcore.image.Colors;
import pulpcore.image.CoreFont;
import pulpcore.image.CoreImage;
import pulpcore.Stage;
import pulpcore.CoreSystem;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.Random;

/**
 * Created by will
 * Date: May 3, 2008 7:47:03 PM
 */
public class LJPulp extends Scene2D {
    CoreFont font;
    protected static void setFont(CoreFont f) {
    }
    static Random r = new Random();

    protected static void srand(long i) {
        r.setSeed(i);
    }
    protected static int rand() {
        return r.nextInt();
    }
    protected static final int SCREEN_H = 480;//Stage.getHeight();
    protected static final int SCREEN_W = 640;//Stage.getWidth();

    protected static void acquire_bitmap(Image i) {

    }
    protected static void release_bitmap(Image i) {

    }
    protected static void destroy_bitmap(Image i) {
        i.flush();
    }

    protected void set_window_title(String s) {
        CoreSystem.setTalkBackField("title",s);
    }

    static protected int makecol(int i, int i1, int i2) {
        return Colors.rgb(i,i1,i2);
    }

    protected int get_refresh_rate() {
        return Stage.getFrameRate();
    }

    protected static void allegro_message(String s) {
        CoreSystem.print(s);
    }

    protected void rest(int i) {
        try {
            Thread.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    protected static BufferedImage create_system_bitmap(int w, int h) {
        return new BufferedImage(w,h, BufferedImage.TYPE_INT_RGB);
    }

    protected static Image create_bitmap(int w, int h) {
        return new BufferedImage(w,h, BufferedImage.TYPE_INT_RGB);
    }

    protected static void acquire_screen() {

    }

    protected static void release_screen() {

    }

    protected static BufferedImage screen;

    protected static void blit(Image bg, Image screen, int pfRight, int i, int pfRight1, int i1, int i2, int i3) {
        
    }
    protected static void vsync() {
        
    }

    protected static void textout_ex(Image screen, CoreFont aver16, String s, int i, int i1, int fgColor, int i2) {

    }
    protected static void textprintf_ex(Image screen, CoreFont aver32, int spawnLeft, int i, int fgColor, int i1, String s) {
    }

    protected static void textprintf_right_ex(Image screen, CoreFont aver32, int i, int i1, int fgColor, int i2, String s) {

    }
    protected static void textprintf_left_ex(Image screen, CoreFont aver32, int i, int i1, int fgColor, int i2, String s) {

    }
    protected static void textout_centre_ex(BufferedImage screen, CoreFont aver32, String s, int i, int i1, int pfFgColor, int i2) {
    }
    protected static void circlefill(Image screen, int x, int y, int r, int fgColor) {
        Graphics2D g = (Graphics2D)screen.getGraphics();
        g.setColor(new Color(fgColor));
        g.fillOval(x,y,r*2,r*2);
        g.dispose();
    }
    protected static void hline(BufferedImage screen, int x, int y, int width, int fgColor) {
        Graphics2D g = (Graphics2D)screen.getGraphics();
        g.setColor(new Color(fgColor));
        g.drawLine(x,y,x+width,y);
        g.dispose();
    }
    protected static void rectfill(BufferedImage screen, int x, int y, int width, int height, int fgColor) {
        Graphics2D g = (Graphics2D)screen.getGraphics();
        g.setColor(new Color(fgColor));
        g.fillRect(x,y,x+width,y+height);
        g.dispose();
    }

    protected static void alert(String s, int i, int i1, int i2) {
        CoreSystem.print(s);
    }

    protected static void draw_sprite(BufferedImage back, CoreImage logo, int x, int y) {

    }

    protected static void clear_to_color(Image bmp, int bgColor) {
        Graphics2D g = (Graphics2D)bmp.getGraphics();
        g.setColor(new Color(bgColor));
        g.fillRect(0,0,bmp.getWidth(null),bmp.getHeight(null));
        g.dispose();
    }
    protected static Image load_bitmap(String filename, Object dunno) {
        return null;
    }
}
